﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace KC.Presentation.Mv8CMS
{
	public partial class ResistPostManager : Form
	{
		private string csMv8 = System.Configuration.ConfigurationManager.ConnectionStrings["MV8"].ConnectionString;

		public ResistPostManager()
		{
			InitializeComponent();
		}

		private void ResistPostManager_Load(object sender, EventArgs e)
		{
			LoadPosts();
		}

		private void LoadPosts()
		{
			dgPosts.DataSource = KC.DataAccess.Global.Global.CallSql_Query(csMv8, "select * from resist..Posts order by id desc");
		}

		private void dgPosts_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
		{
			var result = new ResistPostEditor(int.Parse(dgPosts.Rows[e.RowIndex].Cells["ID"].Value.ToString())).ShowDialog();
			if (result == System.Windows.Forms.DialogResult.OK)
				LoadPosts();
		}
	}
}
